#include "stdafx.h"
#include <math.h>
#include "others/EPropWndEdit.h"
#include "IPropertyHost.h"
#include "EPropListCtrl.h"
#include "EPropertyDouble.h"

EPropertyDouble::EPropertyDouble(IPropertyHost *pHost, const std::wstring &sName, double *pProperty, const std::wstring &sUnit, double dMinAllowed, double dMaxAllowed, bool bEnabled)
    : ENumericProperty(pHost, sName, pProperty, sUnit, bEnabled, dMinAllowed, dMaxAllowed)
{}

EPropertyDouble::~EPropertyDouble()
{}

double EPropertyDouble::GetNumericValue()
{
    double d = *(double *)m_pProperty;
    return d;
}

bool EPropertyDouble::SetNumeric(double dVarValue)
{
    bool bPropertyChanged = false;

    double d = dVarValue;

    if(m_pHost->PropertyChanging(m_pProperty, &d)) {
        *(double *)m_pProperty = d;
        bPropertyChanged = true;
    }

    return bPropertyChanged;
}

int EPropertyDouble::GetNumSignificantDigits()
{
    return 12;
}